package collection;

import java.io.File;
import java.io.IOException;
import java.util.logging.Filter;

public class CreateNewFileDemo {
    public static void main(String[] args) throws IOException {
        File file=new File("test.txt");

    if (file.exists()){
        System.out.println("已存在");
    }else {
        file.createNewFile();
        System.out.println("文件已创建");
    }
    File file1=new File("test,tst");
    if (file.exists()){
        file.delete();
        System.out.println("该文件已删除");

    }else {
        System.out.println("该文件不存在");
    }
File dir=new File("./demo");
    if (dir.exists()){
        System.out.println("该目录已存在");
    }else {
        dir.mkdir();
        System.out.println("该目录已创建");
    }


    }
}
